<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>控制页面 - MQTT控制面板</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <!-- 顶部导航栏 -->
        <header class="header">
            <h1 class="logo">MQTT控制面板</h1>
            <nav class="nav">
                <a href="index.html" class="nav-link">首页</a>
                <a href="config.html" class="nav-link">配置</a>
                <a href="user.html" class="nav-link active">控制</a>
            </nav>
        </header>

        <!-- 主内容区域 -->
        <main class="main-content">
            <h2>设备控制</h2>
            
            <!-- 连接状态显示 -->
            <section class="connection-status-section">
                <div id="mqtt-status" class="status-indicator">
                    <span class="status-dot"></span>
                    <span class="status-text">未连接</span>
                </div>
                <button id="connect-btn" class="btn btn-primary">连接MQTT</button>
                <button id="disconnect-btn" class="btn btn-secondary" style="display: none;">断开连接</button>
                <button id="test-btn" class="btn btn-outline">测试连接</button>
            </section>

            <!-- 控制按钮区域 -->
            <section class="control-section">
                <h3>控制指令</h3>
                <div class="control-grid">
                    <button id="command-btn-1" class="control-btn" disabled>
                        <span class="btn-text">指令1</span>
                        <span class="btn-status">未配置</span>
                    </button>
                    <button id="command-btn-2" class="control-btn" disabled>
                        <span class="btn-text">指令2</span>
                        <span class="btn-status">未配置</span>
                    </button>
                    <button id="command-btn-3" class="control-btn" disabled>
                        <span class="btn-text">指令3</span>
                        <span class="btn-status">未配置</span>
                    </button>
                </div>
            </section>

            <!-- 操作反馈区域 -->
            <section class="feedback-section">
                <h3>操作日志</h3>
                <div id="operation-log" class="log-container">
                    <div class="log-entry">请先连接MQTT并配置指令</div>
                </div>
                <button id="clear-log" class="btn btn-secondary">清空日志</button>
            </section>

            <!-- 返回导航 -->
            <section class="navigation-section">
                <a href="config.html" class="btn btn-outline">返回配置页面</a>
            </section>
        </main>
    </div>

    <script src="mqtt.js"></script>
    <script src="user.js"></script>
</body>
</html>